using System;
using Kugar.Web.Wechat.Enums;

namespace Kugar.Web.Wechat.Entities
{
    [Serializable]
    public class WechatResponseBase
    {
        public virtual WechatResposeMsgType Type { get; }

        public string AppID { set; get; }
        
        public string ToUserOpenID { set; get; }
    }

    [Serializable]
    public class WechatResponseText : WechatResponseBase
    {
        public override WechatResposeMsgType Type { get; }= WechatResposeMsgType.Text;

        public string Content { set; get; }
    }

    [Serializable]
    public class WechatResponseImage : WechatResponseBase
    {
        public override WechatResposeMsgType Type { get; }= WechatResposeMsgType.Image;
        
        public string Media_ID { set; get; }

        public string ImagePath { set; get; }
    }

    [Serializable]
    public class WechatResponseNews : WechatResponseBase
    {
        public override WechatResposeMsgType Type { get; }= WechatResposeMsgType.News;

        public NewsItem[] Articles { set; get; }

        public int ArticleCount { get { return Articles.Length; } }

        public class NewsItem
        {
            public string Title { set; get; }

            public string Description { set; get; }

            public string PicUrl { set; get; }

            public string Url { set; get; }
        }
    }
}